package com.example.thirdhomework

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity

class ThirdActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_third)

        val editText: EditText = findViewById(R.id.editTextText3)
        val confirmButton: Button = findViewById(R.id.button5)

        confirmButton.setOnClickListener {
            val inputText = editText.text.toString()
            val resultIntent = Intent().apply {
                putExtra("RESULT_KEY", inputText)
            }
            setResult(Activity.RESULT_OK, resultIntent)
            finish()
        }
    }
}
